<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.SmsModule.bean.*,com.SmsModule.dao.*,com.UserModule.dao.*"%>  
<%@ page import="util.*" %>
<%
List<TbCommonPhrase> SmsTemplateList =new ArrayList();
    if(request.getParameter("s")!=null)
	 SmsTemplateList=(ArrayList) session.getAttribute("SmsTemplateList");
	  //---------分页
	    int currentPage=1;
	    if(request.getParameter("Page")!=null)
	    {
	        SmsTemplateList=(ArrayList) session.getAttribute("SmsTemplateList");
	    	currentPage=Integer.parseInt(request.getParameter("Page"));
	    }
	//System.out.println("size==" + SmsTemplateList.size());
%>

<jsp:include page="../head.jsp"></jsp:include>
<body>
<div id="pager">
<jsp:include page="../top.jsp"><jsp:param name="topCurrent" value="6" /></jsp:include>    
<jsp:include page="leftSms.jsp">
<jsp:param name="smsSendStyle" value="11" /></jsp:include> 
		<section id="container">
        <div id="crumbs">
        	常用短语 &raquo; 常用短语列表
        </div>
    <div id="main">
			<div class="tabs">
				<ul class="tabs-nav clearfix">
					<li>
						常用短语列表
					</li>
					<li>
						新增常用短语
					</li>
				</ul>
				<div class="tabs-panel">
			<%
			try{
		 	 String resultSM=session.getAttribute("resultSM").toString();
			 if(!resultSM.equals("")){
				 out.println("<script>alertmess('"+resultSM+"');</script>");
				 session.removeAttribute("resultSM");
			 }
			 }catch(Exception ex){
			 
			 }
		 	%>
				 <form action="" method="post" id="form1" name="form2">
					<table width="100%" class="datalist">
						<thead>
							<tr>
								<td class="tc">
									<input type="checkbox" title="全选" onClick="check_allSM('deleteAll')"/>
								</td>
								<td>
									序号
								</td>
								<td>
									短语内容
								</td>
									<td>
									创建人
								</td>
								<td>
									创建时间
								</td>
							
								<td>
									操作
								</td>
							</tr>
							
						</thead>
						<%
						if(SmsTemplateList!=null){
						  
							int i=0;  
							//--------------分页
							MyPagination mPage=new MyPagination();
							SmsTemplateList=mPage.getInitPage(SmsTemplateList,currentPage,10);
							if (SmsTemplateList != null && SmsTemplateList.size() > 0) {
											
							for (TbCommonPhrase tbCommonPhraseBean : SmsTemplateList) {
							i++;
						%>
						<tr>
							<td class="tc">
								<input name="deleteAll" id = "deleteAll" type="checkbox" value="<%=tbCommonPhraseBean.getPhraseId()%>"/>
							</td>
							<script type="text/javascript">
							$(function(){
				 				$('#demo-basic<%=i%>').poshytip();
				   			})
				  			 </script>
				  			 <td><%=((10*(currentPage-1))+i) %></td>
							<td><a id="demo-basic<%=i%>" title="<%=tbCommonPhraseBean.getPhraseContent()%>" href="#"><%=new UtilDAO().sub_String(tbCommonPhraseBean.getPhraseContent())%></a></td>
							<td><%=(new TbUserDAO().getTbUsersByUserId(tbCommonPhraseBean.getUserId())).getUserName()%></td>
							<td><%=tbCommonPhraseBean.getCreateTime().substring(0,19)%></td>
							<td class="tc">
							    
								<a title="删除该记录" class="duanyu_del" style="cursor:hand" onClick="deleteOneSM('../TbSmsTemplateServlet?method=deleteOne&PhraseId=<%=tbCommonPhraseBean.getPhraseId() %>')">删除</a>
							</td>
						</tr> 
					   <%
					   }
					   }
					   
					   %>
					   <%=mPage.printCtrl("SmsModule/SmsTemplate.jsp",currentPage) %>
						<%}
					    %>
					</table>
				</form>
				</div>
				<div class="tabs-panel">
				    <form id="formtemplate" name="formtemplate"   method="post">
                	<table width="100%" class="form">
                      <tr>
                        <th scope="row">常用短语：</th>
                        <td>
                           <textarea cols="80"  rows="5"  id="message" name="message" onmousemove="return checkoverflowSM(formtemplate,70)" onKeyUp="return checkoverflowSM(formtemplate,70)"></textarea>
                            <span>还剩<strong style="color:red;"><font color="#FF0000">
                            <input id="counterMsg" name="counterMsg" style="border:0;color:red;valign:center; background-color:#FFFFFF;background-image:url()" value="70" size="2" type='text' readonly></font></strong>字</span>
                        </td>
                        </tr>
                        <tr>
                        <th scope="row"></th>
                        <td><input type="button" onclick="insertTemplateSM(formtemplate,'../TbSmsTemplateServlet?method=add')" value=" 提  交 " /></td>
                      </tr>
                        </table>
                        </form>
				</div>
		</div>
		</section>
		  <jsp:include page="../foot.jsp"></jsp:include>
	</body>
</html>
